<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    .classA{
      color:red;
    }
    .classB{
      background-color:green;
    }
    .calssC{
      font-size: 40px;
    }

  </style>
</head>
<body>
  <div id="demo">
    <p class='classB' :class='a'>123表达式是字符串</p>
    <p :class='{classA:isA,classB:isB}'>456表达式是对象</p>
    <p :class='["classA","classC"]'>表达式是数组789</p>
    <button @click="update">更新</button>
  </div>
 
  <script src="../js/vue.js"></script>
  <script>
    new Vue({
      el:"#demo",
      data:{
        a:'classA',
        isA:true,
        isB:false,
        color:'red',
        fontSize:'20px'
      },
      methods:{
        update(){
          this.a="classC"
          this.isA= !this.isA
        this.isB=!this.isB
          this.color='blue'
          this.fontSize='30px;'
        }
      }
    })
  </script>
</body>
</html>